home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Mail / MailEnclosure / Source.v0.15 / DocumentController.m < prev    next >
Text File  |  1995-06-12  |  827b  |  52 lines

  1. #import "DocumentController.h"
  2. #import "StringStorage.h"
  3.  
  4. @implementation DocumentController
  5.  
  6. - init
  7. {
  8.    [super init];
  9.  
  10.    docType = [[StringStorage alloc] init];
  11.    panel = nil;
  12.    return self;
  13. }
  14.  
  15. -free
  16. {
  17.    [docType free];
  18.    return [super free];
  19. }
  20.  
  21.  
  22. - setDocType: (const char *) str
  23. {
  24.    [docType setStringValue: str];
  25.    return self;
  26. }
  27.  
  28. - makeKeyAndOrderFront:sender
  29. {
  30.    if(!panel)
  31.    {
  32.       char buf[MAXPATHLEN + 1];
  33.  
  34.       if(!*[docType stringValue])
  35.       {
  36.      NXLogError("Opening a document with unknown nib name.");
  37.      return nil;
  38.       }
  39.  
  40.  
  41.       [[NXBundle bundleForClass:[self class]] 
  42.             getPath: buf forResource: [docType stringValue] ofType:"nib"];
  43.    
  44.       [NXApp loadNibFile:buf owner:self withNames:NO fromZone:[self zone]];
  45.    }
  46.    
  47.    [panel makeKeyAndOrderFront: sender];
  48.    return self;
  49. }
  50.  
  51. @end
  52.